package org.moyrax.compressor;

import java.io.File;
import java.io.Reader;

/**
 * This interface should be used in order to implement a compressor component.
 *
 * @author Matias Mirabelli &lt;lumen.night@gmail.com&gt;
 * @since 0.1.0
 */
public interface Compressor {
  /**
   * Compress the specified file.
   *
   * @param file  File to be compressed.
   * @return Returns a byte array with the compressed data.
   * @throws CompressorException
   */
  public byte[] compress(final File file) throws CompressorException;

  /**
   * Compress the data provided by the specified reader.
   *
   * @param reader Reader which provides the data to be compressed.
   * @param type   Type of compression to be performed.
   *
   * @throws CompressorException
   */
  public byte[] compress(final Reader reader, final String type);

  /**
   * Compress the specified file and writes the result to a new file.
   *
   * @param file        File to be compressed.
   * @param outputFile  File which will contain the compressor results.
   *
   * @throws CompressorException
   */
  public void compress(final File file, final File outputFile)
      throws CompressorException;
}
